Texture is an important visual effect. In the context of computer graphics, texture simultaneously includes both the usual sense of uneven grooves exhibited by an object and the color patterns of the smooth surfaces of an object. In connection with rendering each image, a graphics engine generally creates texture with respect to a number of pieces of image data included in each image. Accordingly, the creation of texture for an image to be rendered by a terminal generally requires significant memory and processing resources. For example, when allocating memory space for the data of each image, for computational and memory management efficiency reasons, the memory space to be allocated is determined to be a bit value that is greater than or equal to the size of the image and is the power of two (e.g., 2048 bytes, 4096 bytes, 8192 bytes, etc.; a gray image size of 32×64 requires 32*64*1 byes). Such conventional allocation of memory space for image rendering results in a significant waste of memory resources.
In order to reduce memory waste caused by the use of texture in the rendering of an image, texture can be pieced together into one large texture map, which is referred to as a texture atlas. As an example, a texture atlas is an image comprising a collection of smaller images (e.g., sub-images) that are combined. The sub-images can be uniformly sized or can vary in size. The use of a texture atlas to process all of the images at one time conserves memory and increases rendering speed. For example, the combination of smaller images to form the texture atlas can re-use sub-images as constituent smaller images of the texture atlas. As an example, the sub-images that are re-used can exhibit a texture that is used in a plurality of portions of the image corresponding to the texture atlas. As another example, the sub-images that are re-used can be pre-stored and used in creating the texture for an image.
According to conventional art, in connection with a graphics engine creating texture atlases, the graphics engine uses static texture atlases (e.g., texture atlases having fixed dimensions), and the dimensions of the static texture atlases generally has a power of two. However, if the dimensions of the static texture atlas used in creating a texture atlas are too large and all of the image data contained in one frame (e.g., a reference to the image to be rendered) does not entirely fill the texture atlas, memory would be wasted. Conversely, if the static texture atlas that is used in creating the texture atlas has dimensions that are too small, the texture atlas may be unable to hold all of the image data for a frame (e.g., because too many sub-images are required to form the texture atlas and not all the required sub-images can fit in texture atlas). As a result, the remaining image data can only be processed by means other than the texture atlas (e.g., via rendering using ordinary texture methods). The use of other means to process the remaining image data (e.g., via rendering using ordinary texture methods) can result in an excessive number of rendering commands and a degradation in rendering performance.
In view of the above, there is a need for an implementation of creating a texture atlas in connection with efficient rendering of images.